package Classes.GameViews.ViewDisplayers.MapTargets// ActionScript file
{
	import Classes.GameDatas.GD_Building;
	import Classes.GameDatas.GD_Building_Sundry;
	import Classes.GameDatas.GD_HavenWall;
	import Classes.GameDatas.GD_Player;
	import Classes.GameUtils.GD_deal;
	import Classes.GameUtils.GU_GetBMPMC;
	import Classes.GameViews.GV_Map;
	import Classes.GameViews.ViewDisplayers.MapTargets.MapMoveTargets.MMT_Character;
	import Classes.GameViews.ViewPanels.VP_FastBuy_actPoint;
	import Classes.GameViews.ViewPanels.VP_errorPanel;
	import Classes.Interfaces.I_NeedSWFSource;
	import Classes.Managers.M_LoadSWFSource;
	import Classes.staticinfo.StaticInfo;
	
	import flash.display.DisplayObject;
	import flash.events.MouseEvent;

	/**
	 *杂物显示类 
	 * @author upstream
	 * 
	 */	
	public class MT_Building_Sundry extends MT_Building
	{
		public function MT_Building_Sundry(gd:GD_Building_Sundry):void
		{
			super(gd);
		}
		
		/**
		 *创建一个杂物 
		 * @param creatData
		 * @return 
		 * 
		 */		
		public static function creat(creatData:GD_Building_Sundry):MT_Building_Sundry
		{
			var returnSundry:MT_Building_Sundry
			returnSundry=new MT_Building_Sundry(creatData);
			return returnSundry;
		}
		
		/**
		 *覆写对象被点击方法 
		 * @param e
		 * 
		 */		
		override public function beClicked(e:MouseEvent):void
		{
			if( GV_Map.instance.buildMode	!=	GV_Map.CANNOTBUILDMODE)return;
			
			//整个游戏的权限由自己控制   10000205系统权限---采集杂物
			if( null==GD_Player.instance.playPowerObj[10000205] || 0==GD_Player.instance.playPowerObj[10000205])
			{
				VP_errorPanel.instance.noPowerMsg();
				return;
			}
			
//			if(this.zombieData.life<1)return;
			if(this.buildingSundryData.currentlife<1)return;
			
			//如果为NPc  则只有在自己家才能过被清除  不能清除别人家的NPc 
			if(GD_deal.instance.getStr(this.buildingSundryData.sundryType)==StaticInfo.NPC_SUNDRY_TYPE)
			{
				if(GD_Player.instance.character.characterState==2)
				{
					return;
				}
			}

			if(VP_FastBuy_actPoint.instance.check()>=3)return;
			GV_Map.instance.controlTarget.setActTarget(this);
		}

		/*getter & setter*/
		public function get buildingSundryData():GD_Building_Sundry
		{
			return this.buildingData as GD_Building_Sundry;
		}
		
		override public function get selectPriority():int
		{ 
			var proority:int=10;
			if(GD_deal.instance.getStr(this.buildingSundryData.sundryType)==StaticInfo.NPC_SUNDRY_TYPE)
			{
				proority=30;
			}
			return proority;
		}

	}
}